<%-- 
    Document   : index
    Created on : Apr 20, 2011, 7:59:13 PM
    Author     : Myhall
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link type="text/css" rel="stylesheet" href="style.css" />
        <title>ODSKartW</title>
    </head>
    <body>
        <h1>Webová kartotéka nad tabuľkou ODS</h1>
        <div id="zalozky">
            Kategória:
            <form name="categoryForm" action="${pageContext.request.contextPath}/ShowMedia" method="post">
                <select name="categoryTitle">
                    <c:choose>
                    <c:when test="${categoryTitle == 'DVD hudební'}">
                    <option  selected="selected" value="DVD hudební">DVD hudební</option>
                    </c:when>
                    <c:otherwise>
                    <option   value="DVD hudební">DVD hudební</option>
                    </c:otherwise>
                    </c:choose>
                    <c:choose>
                    <c:when test="${categoryTitle == 'DVD original'}">
                    <option  selected="selected" value="DVD original">DVD original</option>
                    </c:when>
                    <c:otherwise>
                    <option  value="DVD original">DVD original</option>
                    </c:otherwise>
                    </c:choose>
                     <c:choose>
                    <c:when test="${categoryTitle == 'DVD Časopisy'}">
                    <option  selected="selected" value="DVD Časopisy">DVD Časopisy</option>
                    </c:when>
                    <c:otherwise>
                    <option  value="DVD Časopisy">DVD Časopisy</option>
                    </c:otherwise>
                    </c:choose>
                    <c:choose>
                    <c:when test="${categoryTitle == 'DVD kopie'}">
                    <option  selected="selected" value="DVD kopie">DVD kopie</option>
                    </c:when>
                    <c:otherwise>
                    <option  value="DVD kopie">DVD kopie</option>
                    </c:otherwise>
                    </c:choose>
                    <c:choose>
                    <c:when test="${categoryTitle == 'DVD domácí'}">
                    <option  selected="selected" value="DVD domácí">DVD domácí</option>
                    </c:when>
                    <c:otherwise>
                    <option  value="DVD domácí">DVD domácí</option>
                    </c:otherwise>
                    </c:choose>
                    <c:choose>
                    <c:when test="${categoryTitle == 'DivX DVD'}">
                    <option  selected="selected" value="DivX DVD">DivX DVD</option>
                    </c:when>
                    <c:otherwise>
                    <option  value="DivX DVD">DivX DVD</option>
                    </c:otherwise>
                    </c:choose>
                </select>
                <input type="submit" name="submit" value="Zobraziť" />
                <input type="submit" name="submit" value='Vytvoriť' title="Vytvoriť novú položku" />
            </form>
        </div> 
        <br />
        <br />
        <div id="data">
            <h1><c:out value="${error}" /></h1>
            <h2>Názov záložky: <c:out value="${categoryTitle}" /></h2>
            <br />
            
            <c:if test="${show}">
                <form name="findingForm" action="${pageContext.request.contextPath}/FindMedium" method="post">       
                    Hľadaj: 
                    <input type="text" name="findString"></input>
                        <select name="find">
                            <option value="All">All</option>
                            <c:forEach items="${header1}" var="attribute">
                                <c:if test="${attribute != 'Id'}">
                                 <option value="${attribute}">
                                 <c:out value="${attribute}" />
                                 </option>
                                </c:if>
                            </c:forEach>
                        </select>
                    <input type="submit" name="submit_button" value="Hľadaj" />
                    <input type="hidden" name="categoryTitle" value="${categoryTitle}" />
                    <input type="hidden" name="header1" value="${header1}" />
                    <input type="hidden" name="media" value="${media}" />
                </form>
                <br />
                    <c:out value="${addedItem}" />
                <br />
                <div class="modifyText">Klikni na ID pre modifikáciu</div>
                <table>
                    <tr>
                        <c:forEach items="${header1}" var="attribute">
                            <th><c:out value="${attribute}" /></th>
                        </c:forEach>
                    </tr>
                    <form name="editingForm" action="${pageContext.request.contextPath}/EditMedium" method="post">
                        <c:forEach items="${media}" var="medium">
                            <tr>
                                <td>
                                    <input type="submit" name="Id" value="${medium.ID}" />
                                    <input type="hidden" name="categoryTitle" value="${categoryTitle}" />
                                    <input type="hidden" name="media" value="${media}" />
                                </td>
                                <c:forEach items="${medium.titles}" var="title" >
                                    <td><c:out value="${title.name}" /></td>
                                </c:forEach>
                            </tr>
                        </c:forEach>
                        <input type="hidden" name="categoryTitle" value="${categoryTitle}" />
                    </form>
                </table>
            </c:if>
        </div>
    </body>
</html>
